package priv.tuyou.util;

import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;

/**
 * cookie操作类
 * @author 涂有
 */
public class CookiesUtil {
	
	public static Cookie getCookies(HttpServletRequest requst, String cookieName) {
		
		Cookie[] cookies = requst.getCookies();
		if(cookies == null){
			
			return null;
		}else{
			
			for(int i=0;i<cookies.length;i++){
				
				Cookie cookie = cookies[i];
				if(cookie.getName().equalsIgnoreCase(cookieName)){
					
					return cookie;
				}
			}
		}
		return null;
	}
}
